package com.xwltz.converter;

import lombok.SneakyThrows;
import org.springframework.core.convert.converter.Converter;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.logging.SimpleFormatter;

public class DataConverter implements Converter<String, Date> {

    private String pattern;

    public DataConverter(String pattern) {
        this.pattern = pattern;
    }

    @SneakyThrows
    @Override
    public Date convert(String source) {
        SimpleDateFormat sdf = new SimpleDateFormat(this.pattern);
        Date date = null;
        date = sdf.parse(source);
        return null;
    }
}
